import os
import pymysql
import configparser

class Config:
    def __init__(self):
        pass

    def get_config(self):
        try:
            config = configparser.ConfigParser()
            config_path = os.path.join(os.path.dirname(__file__), 'config.ini')
            # config.read('config.ini')
            config.read(config_path)
        except Exception as e:
            print(e)
        db_config = {
            'host': config['database']['host'],
            'port': int(config['database']['port']),
            'user': config['database']['user'],
            'password': config['database']['password'],
            'db': config['database']['db'],
            'charset': config['database']['charset'],
            'cursorclass': pymysql.cursors.DictCursor
        }
        return db_config

